package com.tg.appcommon.router;

import androidx.annotation.NonNull;

import com.tg.appcommon.business.IAppModule;
import com.tg.appcommon.business.ICarModule;
import com.tg.appcommon.business.ILampModule;
import com.tg.appcommon.business.ILoginModule;
import com.tg.appcommon.business.IMessageModule;

public class TGBusiness {
    @NonNull
    public static IAppModule getAppModule() {
        IAppModule module = TGModuleRouter.getInstance().getBusinessModule(IAppModule.class);
        if (module != null) {
            return module;
        }
        return AppModuleEmptyImpl.empty();
    }

    @NonNull
    public static ILoginModule getLoginModule() {
        ILoginModule module = TGModuleRouter.getInstance().getBusinessModule(ILoginModule.class);
        if (module != null) {
            return module;
        }
        return LoginModuleEmptyImpl.empty();
    }

    @NonNull
    public static ICarModule getCarModule() {
        ICarModule module = TGModuleRouter.getInstance().getBusinessModule(ICarModule.class);
        if (module != null) {
            return module;
        }
        return CarModuleEmptyImpl.empty();
    }

    @NonNull
    public static ILampModule getLampModule() {
        ILampModule module = TGModuleRouter.getInstance().getBusinessModule(ILampModule.class);
        if (module != null) {
            return module;
        }
        return LampModuleEmptyImpl.empty();
    }


    @NonNull
    public static IMessageModule getMessageModule() {
        IMessageModule module = TGModuleRouter.getInstance().getBusinessModule(IMessageModule.class);
        if (module != null) {
            return module;
        }
        return MessageModuleEmptyImpl.empty();
    }

}
